package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;

public class TRIM extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length < 1)
      return Primitive.ERROR_NAME;
    Object localObject = paramArrayOfObject[0];
    if (localObject != null)
      return "" + localObject.trim();
    return localObject;
  }

  public Function.Type getType()
  {
    return Function.TEXT;
  }

  public String getCN()
  {
    return "TRIM(text): 清除文本中所有空格，单词间的单个空格除外，也可用于带有不规则空格的文本。\nText:需要清除空格的文本。\n示例:\nTRIM(\" Monthly Report\")等于Monthly Report。";
  }

  public String getEN()
  {
    return "TRIM(text): Removes all spaces from text except for single spaces between words. Use TRIM on text that you have received from another application that may have irregular spacing.\nText is the text from which you want spaces removed.\n\nExample:\n   TRIM(\" Monthly Report\") = \"Monthly Report\"";
  }
}